package org.market.domain.strategy.service.rule.chain.impl;

import lombok.extern.slf4j.Slf4j;
import org.market.domain.strategy.service.armory.StrategyArmoryDispatch;
import org.market.domain.strategy.service.rule.chain.AbstractLogicChain;
import org.market.domain.strategy.service.rule.chain.factory.DefaultChainFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author:     Insight
 * @Description:  TODO
 * @Date:    2025/2/23 下午11:28
 * @Version:    1.0
 */

@Slf4j
@Component("default")
public class DefaultLogicChain extends AbstractLogicChain {
    @Resource
    private StrategyArmoryDispatch strategyArmoryDispatch;

    @Override
    public DefaultChainFactory.StrategyAwardVO logic(String userId, Long strategyId) {
        Integer awardId = strategyArmoryDispatch.getRandomAwardId(strategyId);
        log.info("责任链-默认过滤开始---userId:{},strategyId:{},ruleModel:{}", userId, strategyId,ruleModel());
        return DefaultChainFactory.StrategyAwardVO.builder().awardId(awardId).awardRuleVale(DefaultChainFactory.logicMode.RULE_DEFAULT.getCode()).build();
    }

    @Override
    public String ruleModel() {
        return "default";
    }
}
